var Adv_skd=require("./Adv_skd")

var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2pvzChannel = require("pvzChannel");
var $2BundleManager = require("BundleManager");
var $2UIManager = require("UIManager");
var $2UserDataManager = require("UserDataManager");
var $2TaSdk = require("TaSdk");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_NoCoinUI = /* */function (_cc$Component52) {
  babel_inherits(h, _cc$Component52);
  var _super56 = babel_createSuper(h);
  function h() {
    var _this120;
    babel_classCallCheck(this, h);
    _this120 = _super56.apply(this, arguments);
    _this120.title = null;
    _this120.title2 = null;
    _this120.icon = null;
    _this120.video1 = null;
    return _this120;
  }
  babel_createClass(h, [{
    key: "init",
    value: function init(e) {
      Adv_skd.default.instance.hideAllAdv();
      Adv_skd.default.instance.showInterstitialAd();
      Adv_skd.default.instance.showGridAdRight();
      Adv_skd.default.instance.showGridAdLeft();
      Adv_skd.default.instance.showBannerAd();

      this.type = e;
      if (0 == e) {
        this.title.string = "金币不足是否获取";
        this.title2.string = "金币X5000";
        this.icon.spriteFrame = $2BundleManager.default.instance.getBundleRes("BundleTexture", "ui/a034", cc.SpriteFrame);
      } else {
        this.title.string = "钻石不足是否获取";
        this.title2.string = "钻石X50";
        this.icon.spriteFrame = $2BundleManager.default.instance.getBundleRes("BundleTexture", "ui/a033", cc.SpriteFrame);
      }
      this.initPlatform();
    }
  }, {
    key: "initPlatform",
    value: function initPlatform() {
      if ($2pvzChannel.pvzChannel.instance().channel.indexOf("wx") >= 0) {
        $2pvzChannel.pvzChannel.instance().showBanner();
        $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
        $2pvzChannel.pvzChannel.instance().getCtrl("p4") && (this.video1.active = false);
      }
    }
  }, {
    key: "onClickGetReward",
    value: function onClickGetReward() {
      console.log("点击获取金币")
      var _this121 = this;
      var e;
      var t;
      var a;
      if (0 == this.type) {
        e = function e() {
          $2UserDataManager.default.instance.gold += 5e3;
          _this121.onClickCloseBtn();
        };
        t = function t() {};
        a = function a() {};
      } else {
        e = function e() {
          $2UserDataManager.default.instance.diamond += 50;
          _this121.onClickCloseBtn();
        };
        t = function t() {};
        a = function a() {};
        $2TaSdk.default.instance.AdsButtonClick($2TaSdk.VideoIndex.diamond);
      }
      $2pvzChannel.pvzChannel.instance().showVideo({
        sucCall: e,
        failCall: t,
        endCall: a
      });
    }
  }, {
    key: "onClickCloseBtn",
    value: function onClickCloseBtn() {
       Adv_skd.default.instance.hideAllAdv();
      
      $2UIManager.default.instance.closeUI("NoCoinUI");
      $2pvzChannel.pvzChannel.instance().channel.indexOf("wx") >= 0 && $2pvzChannel.pvzChannel.instance().closeBanner();
    }
  }]);
  return h;
}(cc.Component);
cc__decorate([ccp_property(cc.Label)], def_NoCoinUI.prototype, "title", undefined);
cc__decorate([ccp_property(cc.Label)], def_NoCoinUI.prototype, "title2", undefined);
cc__decorate([ccp_property(cc.Sprite)], def_NoCoinUI.prototype, "icon", undefined);
cc__decorate([ccp_property(cc.Node)], def_NoCoinUI.prototype, "video1", undefined);
def_NoCoinUI = cc__decorate([ccp_ccclass], def_NoCoinUI);
exports.default = def_NoCoinUI;